package szte.objectorgy.collections;

import szte.objectorgy.collections.TreeMap.RedBlackTreeNode;

/**
 * A Visitor class for printing a subtree of a red-black tree in tree form.
 * @author Endre PALATINUS
 */
public class TreeVisitor {
	
	@SuppressWarnings("rawtypes")
	public static void visit(RedBlackTreeNode node) {		
		
		if (node.left != null) {
			System.out.print(" [");
			visit(node.left);
			System.out.print("] ");
		}
		
		System.out.print(node);
		
		if (node.right != null) {
			System.out.print(" [");
			visit(node.right);
			System.out.print("] ");
		}
	}
}
